﻿<UserControl x:Class="Microsoft.Forums.ForumsClient.Views.ToolBarTrayView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" MinHeight="28"
    xmlns:ForumsClient="clr-namespace:Microsoft.Forums.ForumsClient"
    xmlns:Views="clr-namespace:Microsoft.Forums.ForumsClient.Views">

    <UserControl.Resources>
        <!-- ToolBarButtonStyle for Views:TextImageButton when used as Toolbar Button -->
        <Style x:Key="ToolBarButtonStyle" TargetType="{x:Type Views:TextImageButton}">
            <Setter Property="BorderThickness" Value="0.7"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Padding" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Views:TextImageButton}">
                        <Border x:Name="ToolBarButtonBorder" Width="Auto" Height="Auto" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"  BorderThickness="{TemplateBinding BorderThickness}">
                            <StackPanel x:Name="stackPanel" Width="Auto" Height="Auto" Orientation="Horizontal">
                                <Image Margin="2,0,2,0" VerticalAlignment="Center" Width="18" Height="18" 
				  Source="{TemplateBinding Source}"/>
                                <TextBlock HorizontalAlignment="Left" Margin="0,0,5,0" VerticalAlignment="Center" 
				  Text="{TemplateBinding Text}" TextWrapping="Wrap"/>
                            </StackPanel>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsKeyboardFocused" Value="true">
                                <Setter Property="BorderBrush" Value="{DynamicResource DefaultedBorderBrush}" 
                                    TargetName="ToolBarButtonBorder"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter Property="BorderBrush" Value="{DynamicResource DefaultBorder}" TargetName="ToolBarButtonBorder"/>
                                <Setter Property="BorderThickness" Value="0.7" TargetName="ToolBarButtonBorder" />
                                <Setter Property="Background" TargetName="ToolBarButtonBorder" Value="{DynamicResource OnMouseOverBrush}"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="true">
                                <Setter Property="Background" Value="{DynamicResource OnPressBackground}" TargetName="ToolBarButtonBorder"/>
                                <Setter Property="BorderBrush" Value="{DynamicResource DefaultBorder}" TargetName="ToolBarButtonBorder"/>
                                <Setter Property="BorderThickness" Value="0.7" TargetName="ToolBarButtonBorder" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="true"/>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="ToolBarButtonBorder"/>
                                <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="ToolBarButtonBorder"/>
                                <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </UserControl.Resources>
    <Grid>
		
        <ToolBarTray HorizontalAlignment="Stretch" 
                     x:Name="ToolBarTrayControl" Background="{DynamicResource DefaultBrush}"
                     VerticalAlignment="Top">
		
            <ToolBar Band="1" BandIndex="1" 
                     Height="28" x:Name="ImageToolBar" 
                     BorderBrush="{DynamicResource DefaultBorder}" 
                     Background="{DynamicResource DefaultBackground}"  
                     Width="{Binding Path=ActualWidth, ElementName=ToolBarTrayControl, Mode=Default}"
                     BorderThickness="0,0,0,0.5">

                

                <Views:TextImageButton Style="{DynamicResource ToolBarButtonStyle}" 
                                       x:Name="SubscribeButton"
                                       Source="images\Subscribe.ico"  
                                       Text="Subscribe" 
                                       Width="Auto" Height="Auto" 
									   Background="{x:Null}" 
									   BorderBrush="{x:Null}" 
                                       BorderThickness="0.7,0.7,0.7,0.7" 
                                       ToolTip="Subscribe to Forums"  
                                       Command="{x:Static ForumsClient:Commands.ShowSubscribeDialog}" />
                
                
                <Views:TextImageButton Style="{DynamicResource ToolBarButtonStyle}" 
                                       x:Name="OptionsButton"
                                       Source="images\Options.ico"  
                                       Text="Options" 
                                       Width="Auto" Height="Auto" 
									   Background="{x:Null}" 
									   BorderBrush="{x:Null}" 
                                       BorderThickness="0.7,0.7,0.7,0.7" 
                                       ToolTip="Options"  
                                       Command="{x:Static ForumsClient:Commands.ShowOptionsSettingsDialog}" />

                <Views:TextImageButton Style="{DynamicResource ToolBarButtonStyle}" 
                                       x:Name="ThemeButton"
                                       Source="images\Theme.ico"  
                                       Text="Theme" 
                                       Width="Auto" Height="Auto" 
									   Background="{x:Null}" 
									   BorderBrush="{x:Null}" 
                                       BorderThickness="0.7,0.7,0.7,0.7" 
                                       ToolTip="Change Theme"  
                                       Command="{x:Static ForumsClient:Commands.ChangeTheme}" />

            </ToolBar>
        </ToolBarTray> 
    </Grid> 
</UserControl> 




        

    
    